#ifndef __APP_MQTT_H__
#define __APP_MQTT_H__

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "MQTTClient.h"
#include "log/log.h"
 
#define ADDRESS     "ws://192.168.21.57:1883"
#define CLIENTID    "b253ba38-daf6-4b37-984f-5d8fdc6a1cfa" 
#define TOPIC_PULL       "remote_to_gateway"
#define TOPIC_PUSH       "gateway_to_remote"
#define PAYLOAD     "Hello World!"
#define QOS         1
#define TIMEOUT     10000L

typedef int (*mqtt_rec_callback)(char *);
/**
 * @brief 初始化MQTT
 *
 * @return int 0:成功 -1:失败
 */
int app_mqtt_init(void);

/**
 * @brief 发送消息
 * @param json 要发送的消息
 * @return int 0:成功 -1:失败
 */
int app_mqtt_send(char *json);

/**
 * @brief 关闭MQTT
 * @return int 0:成功 -1:失败
 * */
 int app_mqtt_close(void);

 void app_mqtt_register_recv_callback(mqtt_rec_callback callback);



#endif /* __APP_MQTT_H__ */